<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    function myMap(arr,fn){//传入的数组arr和回调函数fn(处理数组的)
        var myArray =[];//用来保存处理后的结果
        for(var i=0;i<arr.length;i++){//循环需要处理的数组，对每个进行相应处理
            myArray.push(fn(arr[i],i,arr))//利用push将结果存到myArray中去
        }
        return myArray;
    }
    var arr=[4,6,3];
    var result =myMap(arr,(item)=>{return item*3-1});
    console.log(result);
</script>
<body>
    
</body>
</html>